package com.aijk.web.admin.controller.openapi.entity;

/**
 * Created by iscdw on 2016/5/21.
 */
public class ApiContext {

    /**
     * API接口ID
     */
    private String apiId;
    /**
     * 请求ID
     */
    private String reqid;
    /**
     * 访问来源IP
     */
    private String clientIp;

    /**
     * App名称
     */
    private String appKey;

    /**
     * 用户对象
     */
    private Long uid;

    /**
     * APP_ID 接入应用的标识
     */
    private int appid;

    /**
     * <pre>
     * 应用平台
     01         PC
     02         H5
     03         微信
     04         安卓
     05         苹果
     99         未说明

     * 表字段 : eop_app.platform
     * </pre>
     *
     */
    private String platform;
    
    /**
     * <pre>
     * 表字段 : eop_app.app_code
     * </pre>
     */
    private String appCode;

    private String version;

    private static final ThreadLocal<ApiContext> LOCAL = new ThreadLocal<ApiContext>() {
        @Override
        protected ApiContext initialValue() {
            return new ApiContext();
        }
    };

    public static ApiContext getContext() {
        return LOCAL.get();
    }

    public static void removeContext() {
        LOCAL.remove();
    }
    
    public String getClientIp() {
        return clientIp;
    }

    public void setClientIp(String clientIp) {
        this.clientIp = clientIp;
    }


    public String getAppKey() {
        return appKey;
    }

    public void setAppKey(String appKey) {
        this.appKey = appKey;
    }

    public String getVersion() {
        return version;
    }

    public void setVersion(String version) {
        this.version = version;
    }

    public String getReqid() {
        return reqid;
    }

    public void setReqid(String reqid) {
        this.reqid = reqid;
    }

    public String getApiId() {
        return apiId;
    }

    public void setApiId(String apiId) {
        this.apiId = apiId;
    }

    public Long getUid() {
        return uid;
    }

    public void setUid(Long uid) {
        this.uid = uid;
    }

    public int getAppid() {
        return appid;
    }

    public void setAppid(int appid) {
        this.appid = appid;
    }

    public String getPlatform() {
        return platform;
    }

    public void setPlatform(String platform) {
        this.platform = platform;
    }

    public String getAppCode() {        return appCode;    }

    public void setAppCode(String appCode) {
        this.appCode = appCode;
    }
}
